package com.selftool.gui.serverframe.action;

import com.selftool.base.NCButton;
import com.selftool.bo.DosBO;
import com.selftool.log.Logger;
import com.selftool.util.CommonUtil;

/**
 * 重启按钮
 */
public class ReStartButton extends NCButton {
    /**
     * @param obj
     */
    @Override
    protected void execute(Object obj) throws Exception {
        Logger.write("进入ReStartButtond实现");
        CommonUtil util = CommonUtil.getCommonUtil();
        String homepath = util.getParameter("homepath");
        boolean isWindows = util.isWindows();
        String command = "";
        if(isWindows){
            command = "call "+ homepath + "\\stop.bat && call "+ homepath+"\\startup.bat";
        }else{
            command = homepath + "/stop.sh ; "+ homepath+"/startup.sh";
        }
        Logger.write("start:"+command);
        new DosBO().exec(command);
    }
}
